<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>新增/修改栏目</title>
    {sys:load href="admin/css/bootstrap.min.css,admin/css/materialdesignicons.min.css,admin/css/style.min.css,admin/lib/layui/css/layui.css"}

    <script src="/public/static/codemini/lib/codemirror.js"></script>
    <link rel="stylesheet" href="/public/static/codemini/lib/codemirror.css">
    <link rel="stylesheet" href="/public/static/codemini/addon/fold/foldgutter.css">
    <link rel="stylesheet" href="/public/static/codemini/addon/dialog/dialog.css">
    <link rel="stylesheet" href="/public/static/codemini/theme/monokai.css">
    <link rel="stylesheet" href="/public/static/codemini/addon/dialog/dialog.css">
    <link rel="stylesheet" href="/public/static/codemini/addon/search/matchesonscrollbar.css">

    <script src="/public/static/codemini/mode/javascript/javascript.js"></script>
    <script src="/public/static/codemini/addon/display/fullscreen.js"></script>
    <script src="/public/static/codemini/keymap/sublime.js"></script>

    <script src="/public/static/codemini/addon/dialog/dialog.js"></script>
    <script src="/public/static/codemini/addon/search/searchcursor.js"></script>
    <script src="/public/static/codemini/addon/search/search.js"></script>
    <script src="/public/static/codemini/addon/scroll/annotatescrollbar.js"></script>
    <script src="/public/static/codemini/addon/search/matchesonscrollbar.js"></script>
    <script src="/public/static/codemini/addon/search/jump-to-line.js"></script>

    {sys:load href="admin/lib/layui/layui.js,admin/common.js,admin/lib/ueditor/ueditor.config.js,admin/lib/ueditor/ueditor.all.min.js"}
    <style>
        .form-control{
            color: #333333;
            font-size: 16px;
        }
        .CodeMirror{
            height: 600px;
        }
    </style>
</head>

<body>
<div class="container-fluid p-t-15">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body">
                    <form action="/app/cms/admin.column/savehtml" method="post" class="row" id="column">

                        <div class="tab-content active0">
                            <div class="tab-pane active">
                                <div class="form-group col-md-12">
                                    {sys:img id="thumb" default=""}
                                </div>
                            </div>
                        </div>

                        <div class="tab-content active0">
                            <div class="tab-pane active">
                                <div class="form-group col-md-12">
                                    <label>web</label>
                                    <textarea class="form-control" id="code" rows="65" name="web_editor" placeholder="" >{$webHtmlData}</textarea>
                                </div>
                                <input type="hidden" name="web" value="" id="web" />
                            </div>
                        </div>

                        <div class="tab-content active1">
                            <div class="tab-pane active">
                                <div class="form-group col-md-12">
                                    <label>wap</label>
                                    <textarea class="form-control" id="codewap" rows="65" name="wap_editor" >{$wapHtmlData}</textarea>
                                    <input type="hidden" value="" id="wap" name="wap" />
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-md-12">
                            <input type="hidden" name="lang_id" value="{$Request.session.admin.lang.id}" />
                            <input type="hidden" name="id" value="{$column.id}" />
                            <button type="button" class="btn btn-primary btn-submit" form-id="column">确 定</button>
                        </div>
                    </form>
                </div>

            </div>


        </div>

    </div>
</div>

<script type="text/javascript">
    layui.use(['Request','jquery','layer','laydate','upload'], function(){
        var Request = layui.Request,$ = layui.jquery,layer = layui.layer,laydate = layui.laydate,upload = layui.upload;

        var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
            lineNumbers: true,
            keyMap: "sublime",
            autoCloseBrackets: true,
            matchBrackets: true,
            showCursorWhenSelecting: true,
            theme: "monokai",
            tabSize: 2,
            extraKeys: {
                "F11": function(cm) {
                    cm.setOption("fullScreen", !cm.getOption("fullScreen"));
                },
                "Esc": function(cm) {
                    if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
                }
            }
        });

        var editor1 = CodeMirror.fromTextArea(document.getElementById("codewap"), {
            lineNumbers: true,
            keyMap: "sublime",
            autoCloseBrackets: true,
            matchBrackets: true,
            showCursorWhenSelecting: true,
            theme: "monokai",
            tabSize: 2,
            extraKeys: {
                "F11": function(cm) {
                    cm.setOption("fullScreen", !cm.getOption("fullScreen"));
                },
                "Esc": function(cm) {
                    if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
                }
            }
        });

        $(".btn-submit").click(function(){
            $("#web").val(editor.getValue());
            $("#wap").val(editor1.getValue());
            Request.postInSubmit(".btn-submit", function(response){
                layer.msg('操作成功', {time:2000}, function(){
                    parent.location.reload()
                })
            })
        });

        $(".page-tabs li").click(function(){
            var index = $(this).index();
            $(this).addClass('active')
            $(this).siblings('li').removeClass('active');
            $(".active" + index).css('visibility','visible');
            $(".active" + index).siblings('.tab-content').css('visibility', 'hidden');
        });

    });


</script>
</body>
</html>
